Skip to content

Instantly share code, notes, and snippets.

View andrewcmyk's full-sized avatar

Andrew Le andrewcmyk

View GitHub Profile
@abelorian
abelorian / agora.rb
Last active September 22, 2023 11:35
Agora dynamic Key ruby RTC example. Gem agora_dynamic_key https://rubygems.org/gems/agora_dynamic_key
# In Gemfile: gem 'agora_dynamic_key', '~> 0.1.0'
require 'dynamic_key'
class Agora
EXPIRATION_TIME_IN_SECONDS = 3600*3
def generate_rtc_token channel_name = 'any_channel_name'
params = {
@steven2358
steven2358 / ffmpeg.md
Last active April 21, 2024 02:08
FFmpeg cheat sheet
@sscotth
sscotth / keystroke the clipboard extended.workflow
Last active April 17, 2024 12:21
Paste as keystrokes (macOS)
# Why?
# To paste text into windows that normally don't allow it or have access to the clipboard.
# Examples: Virtual machines that do not yet have tools installed, websites that hijack paste
#
# Extended vs Simple?
# * Includes an initial delay to allow you to change active windows
# * Adds small delay between keypresses for slower responding windows like SSH sessions
# * Better handling of numbers
# * VMWare bug fix
#
@CaptEmulation
CaptEmulation / tax.js
Last active February 6, 2016 02:49
2014 Bitcoin taxes cost basis and income calculations. Uses Libra Tax files as input
var argv = require('minimist')(process.argv.slice(2));
var fs = require('fs');
var csvParse = require('csv-parse');
var csvStringify = require('csv-stringify');
var moment = require('moment');
if (argv._.length === 0) {
console.log('Usage: node tax --year 2014 Libra.csv output.csv');
process.exit();
}
@bitkidd
bitkidd / aws-vesta-s3.md
Last active October 17, 2023 18:58
AWS S3 backup for Vesta

Before doing all this you have to create a bucket in your AWS console. Or just use AWS cli tool in order to create one.

  • Install pip (if not installed already):
$ curl -O https://bootstrap.pypa.io/get-pip.py
  • Install AWS cli tool:
$ sudo pip install awscli
@chrisvanpatten
chrisvanpatten / readme.md
Last active September 18, 2020 14:16
Super-simple way to grab a few Instagram images and cache them w/ WordPress

This is an easy way to integrate a basic Instagram feed into a WordPress site.

Setup

First, register with Instagram's developer program, then register a client. Set the client ID they provide you in line 4.

Second, get your Instagram user ID by running this in your terminal:

curl -X GET https://api.instagram.com/v1/users/search\?q\=USERNAME\&client_id\=CLIENT_ID
@kaloprominat
kaloprominat / macos: manage add list remove login items apple script
Last active April 11, 2024 23:22
macos: manage add list remove login items apple script
# applescript
# add login item
osascript -e 'tell application "System Events" to make login item at end with properties {name: "Notes",path:"/Applications/Notes.app", hidden:false}'
# delete login item
osascript -e 'tell application "System Events" to delete login item "itemname"'
# list loginitems
osascript -e 'tell application "System Events" to get the name of every login item'
@meleyal
meleyal / osx.sh
Last active May 18, 2023 19:40
OSX defaults, based on http://mths.be/osx
##
# OSX defaults, based on http://mths.be/osx
#
# Ask for the administrator password upfront
sudo -v
# Set computer name (as done via System Preferences → Sharing)
sudo scutil --set ComputerName "air"
sudo scutil --set HostName "air"
@wrburgess
wrburgess / gist:5528649
Last active November 24, 2022 15:29
Backup Heroku Postgres database and restore to local database

Grab new backup of database

Command: heroku pgbackups:capture --remote production

Response: >>> HEROKU_POSTGRESQL_COLOR_URL (DATABASE_URL) ----backup---> a712

Get url of backup download

Command: heroku pgbackups:url [db_key] --remote production

@feedmeastraycat
feedmeastraycat / get_post_id_by_meta_key_and_value.php
Created July 7, 2012 11:32
WordPress: Get post id by meta key and value
<?php
if (!function_exists('get_post_id_by_meta_key_and_value')) {
/**
* Get post id from meta key and value
* @param string $key
* @param mixed $value
* @return int|bool
* @author David M&aring;rtensson <david.martensson@gmail.com>
*/
function get_post_id_by_meta_key_and_value($key, $value) {