Skip to content

Instantly share code, notes, and snippets.

View cristianoliveira's full-sized avatar
😁
Foo bar

Cristian Oliveira cristianoliveira

😁
Foo bar
View GitHub Profile
@cristianoliveira
cristianoliveira / nix-generate-hash.sh
Created October 5, 2024 18:53
bash script generate nix package hashes
#!/usr/bin/env bash
# First get version from the latest git tag
VERSION="$(git describe --tags --abbrev=0)"
NIX_FILE="nix/package.nix"
echo "Bumping version to $VERSION"
# replace version = "local-2024-09-16"; within "$NIX_FILE"
sed -i "s/version = \".*\";/version = \"$VERSION\";/" "$NIX_FILE"
sed -i 's/sha256-.*=//g' "$NIX_FILE"
https://archive.ph/XeZO5
It's 2024! Please avoid writing SSH commands like that.
Instead, configure your ~/.ssh/config with LocalForward, RemoteForward, and ProxyJump. This can save you a significant amount of time, especially when using ssh, scp, or rsync to transfer data from a remote server that requires multiple intermediate SSH connections.
e.g:
Host jump-host-1
HostName jump1.example.com
User your_username
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>Express checkout example</title>
<script charset="utf-8">
// API Key from https://me.sumup.com/pt-br/developers section OAuth
// That should be a publishable key
// With this API key we can identify the merchant
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
@cristianoliveira
cristianoliveira / optimize-img.sh
Created August 28, 2019 11:42
Small script to optimize images
#!/usr/bin/env bash
FILEPATH="$1"
FILENAME="${2?"No file name provided"}"
if hash optipng 2>/dev/null; then
echo "Optmizing image"
cp "$FILEPATH" "$FILEPATH-bkp.png"
optipng -o5 "$FILEPATH"
else
@cristianoliveira
cristianoliveira / karabiner.json
Created August 5, 2019 14:39
My keyboard configs
{
"global": {
"check_for_updates_on_startup": false,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
@cristianoliveira
cristianoliveira / example.js
Last active July 25, 2018 12:29
Example event use
// Use case
// Render things based on the experiment variant
class FooTest extends Component {
static propTypes = {
children: PropTypes.node,
className: PropTypes.string
};
constructor(props) {
@cristianoliveira
cristianoliveira / jenkins.sh
Last active June 4, 2018 14:39
jenkins-deploy-command.sh
#!/bin/bash -l
set -e # fail on error
set -u # do not allow unset variables
# use the correct exit code, when piping commands, e.g.
# here you use curl ... | python... so if curl fails, python will still
# continure working
set -o pipefail
function fibCreate() {
return function fibonacci(num) {
if (num <= 1) return 1;
return fibonacci(num - 1) + fibonacci(num - 2);
};
}
for (var i = 0, len = 40; i < len; i++) {
fibCreate()(i);
@cristianoliveira
cristianoliveira / AGeneraInternationalAddress.js
Last active April 3, 2018 17:45
Same same but different - post
// This is the common field set free of country specific things.
function GeneralInternationalAddress(props) {
return (
<Fragment>
<AddressLineInput value={props.address_line} />
<AddressLineInput
name="address_line2"
value={props.address_line2}
optional