Skip to content

Instantly share code, notes, and snippets.

View otanim's full-sized avatar
👁️

Arman Yeghiazaryan otanim

👁️
View GitHub Profile
@ladamson
ladamson / genisoimage
Last active October 5, 2023 18:08
Burn encrypted CD/DVD/BD (Bluray) with K3b. Keywords: Linux, Debian, Ubuntu
#!/bin/bash
#
# Purpose:
#
# When you burn with K3b, this script will prompt for your
# desired encryption password (twice), and will encrypt the
# generated ISO with that password. If your passwords don't
# match, you will be prompted to enter them again. Your chosen
# password must be at least 20 characters long (this is a
# requirement of aespipe).
@nmsdvid
nmsdvid / new_gist_file.js
Created February 4, 2014 16:32
Simple JavaScript Debounce Function
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
clearTimeout(timeout);
@tmarshall
tmarshall / aws-sns-example.js
Last active October 30, 2022 06:12
aws-sdk sns example, in Node.js
var AWS = require('aws-sdk');
AWS.config.update({
accessKeyId: '{AWS_KEY}',
secretAccessKey: '{AWS_SECRET}',
region: '{SNS_REGION}'
});
var sns = new AWS.SNS();
@uzysjung
uzysjung / ebFont.config
Last active February 19, 2025 15:32
add custom font to Amazon linux
container_commands:
01_download_nanum_font:
command: wget http://static.campaign.naver.com/0/hangeul/renew/download/NanumFont_TTF.zip
02_unzip_font:
command: unzip Nanum*.zip
03_creat_fontdir:
command: mkdir -p /usr/share/fonts/nanumfont
04_mv_font:
command: mv *.ttf /usr/share/fonts/nanumfont
05_add_font_cache:
@syafiqfaiz
syafiqfaiz / how-to-copy-aws-rds-to-local.md
Last active December 8, 2024 22:08
How to copy production database on AWS RDS(postgresql) to local development database.
  1. Change your database RDS instance security group to allow your machine to access it.
    • Add your ip to the security group to acces the instance via Postgres.
  2. Make a copy of the database using pg_dump
    • $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
    • you will be asked for postgressql password.
    • a dump file(.sql) will be created
  3. Restore that dump file to your local database.
    • but you might need to drop the database and create it first
    • $ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
  • the database is restored
@gaearon
gaearon / index.js
Last active January 21, 2025 08:07
Breaking out of Redux paradigm to isolate apps
import React, { Component } from 'react'
import Subapp from './subapp/Root'
class BigApp extends Component {
render() {
return (
<div>
<Subapp />
<Subapp />
<Subapp />
@arahmanali
arahmanali / mongoose-ref-model-service.js
Last active March 12, 2020 22:38
Mongoose nested query on Model by field by its referenced model.
/*
Find all companies that people with lastname "Robertson" have founded
*/
var mongoose = require('mongoose');
var PersonSchema = new mongoose.Schema {
firstname: String,
lastname: String
};
var Person = mongoose.model('Person', PersonSchema);
@icodeforlove
icodeforlove / Float32Array.concat.js
Last active March 7, 2022 23:09
Float32Array concatenation uses buffers
Float32Array.prototype.concat = function() {
var bytesPerIndex = 4,
buffers = Array.prototype.slice.call(arguments);
// add self
buffers.unshift(this);
buffers = buffers.map(function (item) {
if (item instanceof Float32Array) {
return item.buffer;
@mosampaio
mosampaio / README.md
Last active May 26, 2024 20:00
Simple Phone Verification with Twilio, Node.js, Mongoose, and jQuery Raw

Please make sure you have set the following environment variables:

(This URL should be accessible thru the web. You can use Ngrok to help you if you are testing locally.)

export TWIML_SERVER_URL=https://www.example.org/twiml/

(This information can be found in your Twilio dashboard)

export TWILIO_ACCOUNT_SID=your-account-sid
@shakalaca
shakalaca / ct_monitor
Last active October 3, 2020 18:53
Switch root on / off
#!/system/bin/sh
if [ -f /system/xbin/su_ ]; then
# grant permission for changing & executing files (copy from ota survival program)
/system/xbin/supolicy --live "allow init system_file file { write setattr relabelfrom rename }"
/system/xbin/supolicy --live "allow init install_recovery_exec file { setattr relabelfrom relabelto rename }"
/system/xbin/supolicy --live "allow init zygote_exec lnk_file { unlink } "
mount -o rw,remount /system