Skip to content

Instantly share code, notes, and snippets.

View jeffryang24's full-sized avatar

Jeffry Angtoni jeffryang24

View GitHub Profile
@jeffryang24
jeffryang24 / cloudSettings
Created May 24, 2017 14:26
Visual Studio Code Settings Sync Gist
{"lastUpload":"2017-05-24T14:26:55.507Z","extensionVersion":"v2.8.0"}
@jeffryang24
jeffryang24 / cloudSettings
Created May 24, 2017 14:27
Visual Studio Code Settings Sync Gist
{"lastUpload":"2017-05-24T14:27:22.314Z","extensionVersion":"v2.8.0"}
@jeffryang24
jeffryang24 / mcrypt-cbc.php
Created June 19, 2017 10:01 — forked from joshhartman/mcrypt-cbc.php
Rijndael 256-bit Encryption Function (CBC)
<?php
// Define a 32-byte (64 character) hexadecimal encryption key
// Note: The same encryption key used to encrypt the data must be used to decrypt the data
define('ENCRYPTION_KEY', 'd0a7e7997b6d5fcd55f4b5c32611b87cd923e88837b63bf2941ef819dc8ca282');
// Encrypt Function
function mc_encrypt($encrypt, $key){
$encrypt = serialize($encrypt);
$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC), MCRYPT_DEV_URANDOM);
$key = pack('H*', $key);
@jeffryang24
jeffryang24 / gpg-import-and-export-instructions.md
Created September 12, 2017 17:29 — forked from chrisroos/gpg-import-and-export-instructions.md
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

@jeffryang24
jeffryang24 / pip-upgrade.sh
Created April 16, 2018 11:51
pip recursive upgrade packages
#!/bin/bash
# Upgrade all pip outdated packages
pip install -U -r <(pip list --outdated --format=freeze | sed 's/==/>=/')
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@jeffryang24
jeffryang24 / update-docker-compose.sh
Created May 14, 2018 17:19 — forked from jcberthon/update-docker-compose.sh
Downloading and installing/updating latest Docker Compose (command line)
#!/bin/bash
# Copyright 2017-2018 Jean-Christophe Berthon
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@jeffryang24
jeffryang24 / rsync-incremental-backup.sh
Created May 28, 2018 10:58 — forked from morhekil/rsync-incremental-backup.sh
Shell script to handle incremental data backups with rsync. Optimised to handle large number of infrequently changing files, by using hard links to save on used disk space. For more details - http://localhost:4000/2014/01/12/automatic-backups-with-ruby-and-linux-shell-part-3/
#!/bin/bash
# Rsync based file backup script, with hard-linking enabled.
#
# Runtime options:
# -n - dry-run; do nothing, just display what is going to happen on a real run
# -v - verbose output; print out what is being backed up
#
# set to your rsync location
@jeffryang24
jeffryang24 / backup.sh
Created May 30, 2018 12:37 — forked from arunk-s/backup.sh
Shell Script for taking Incremental Backup and store it at a remote place
# backup.sh
# The contents of this file are released under the GNU General Public License. Feel free to reuse the contents of this work, as long as the resultant works give proper attribution and are made publicly available under the GNU General Public License.
# By Arun Sori <arunsori94@gmail.com>
#For taking backup of the desired directory and store it at a remote place
#timestamp
time_stamp=`date`
#backup file name
@jeffryang24
jeffryang24 / simple_args_parsing.sh
Created June 12, 2018 10:51 — forked from jehiah/simple_args_parsing.sh
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"