Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Function to recursively reinstall packages
reinstall_packages() {
local package=$1
local dependencies=$(apt-cache depends $package | grep "Depends:" | awk '{print $2}')
for dep in $dependencies; do
reinstall_packages $dep
done
@jackyq2015
jackyq2015 / redux-performance-mark.js
Created December 14, 2019 01:02 — forked from clarkbw/redux-performance-mark.js
A User Timing middleware for redux to create performance markers for dispatched actions
const timing = store => next => action => {
performance.mark(`${action.type}_start`);
let result = next(action);
performance.mark(`${action.type}_end`);
performance.measure(
`${action.type}`,
`${action.type}_start`,
`${action.type}_end`
);
return result;
@jackyq2015
jackyq2015 / .bashrc
Created November 21, 2019 21:05 — forked from miracle2k/.bashrc
Convert an existing docker container into a "docker run" command line
# Convert an existing docker container into a "docker run" command line.
#
# This is useful when trying to debug containers that have been created
# by orchestration tools.
#
# Install jq: stedolan.github.io/jq/
function format_run() {
cid=$1
@jackyq2015
jackyq2015 / delete_email.py
Created October 29, 2019 23:57 — forked from giovaneliberato/delete_email.py
Python script to delete emails from a specific sender at gmail
#coding: utf-8
import imaplib
import sys
'''
Simple script that delete emails from a given sender
params:
-username: Gmail username
-pw: gmail pw
-label: If you have a label that holds the emails, specify here
@jackyq2015
jackyq2015 / meta-tags.md
Created October 10, 2019 16:32 — forked from kevinSuttle/meta-tags.md
List of Usable HTML Meta and Link Tags
@jackyq2015
jackyq2015 / index.js
Created August 19, 2018 15:22 — forked from jugyo/index.js
An example to send email with Cloud Pub Sub and Cloud Functions #Rails
const sendEmail = require('./sendEmail').sendEmail;
/**
* Deplooyment:
*
* $ gcloud beta functions deploy sendEmail --trigger-topic sendEmail
*
*/
/**
@jackyq2015
jackyq2015 / json_cast_test.json
Created July 12, 2018 02:59
reproduce the json cast bug. Failed invoking the getRequests function. Exception: type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'String'
import 'dart:convert';
void main() {
for (int i = 0; i < 5; i++) {
print('hello ${i + 1}');
}
String json =
"[ { \"customerName\":\"Jack Kal\", \"fromAddress\":\"120 King Street, \", \"fromLocation\":{ \"latitude\":123, \"longitude\":456.88 }, \"item\":\"lipstick\", \"notes\":\"small, pick up by receipeint\", \"price\":5, \"requestTimeStamp\":\"201806301359\", \"requstId\":123456, \"status\":\"pending\", \"toAddress\":\"6666 Harlow Road, L5N4T2, Mississuaga, ON \", \"toLocation\":{ \"latitude\":125, \"longitude\":458.88 } }, { \"customerName\":\"Jet Lee\", \"fromAddress\":\"240 Queen Street, \", \"fromLocation\":{ \"latitude\":1239, \"longitude\":456.88 }, \"item\":\"milk powder\", \"notes\":\"drop off\", \"price\":6, \"requestTimeStamp\":\"201806301959\", \"requstId\":123457, \"status\":\"pending\", \"toAddress\":\"8888 Harlow Road, L5N4T2, Mississuaga, ON \", \"toLocation\":{ \"latitude\":125, \"longitude\":458.88 }, \"weight\":\"8 KG\" } ]";
@jackyq2015
jackyq2015 / necessary_client.html
Created March 11, 2018 23:55 — forked from Scarygami/necessary_client.html
Google Sign-In 2.0 Server-side samples
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Google Sign-in 2.0 - Necessary Client</title>
<script src="https://apis.google.com/js/client:platform.js?onload=clientLoaded" async defer></script>
</head>
<body>
<button id="enable_offline_access">Enable Offline Access</button>
@jackyq2015
jackyq2015 / gist:1629b3889792eeca79a0980bd0738a71
Created March 31, 2017 01:30 — forked from fernandoaleman/gist:5083680
How to update VirtualBox Guest Additions with vagrant
# Start the old vagrant
$ vagrant init centos-6.3
$ vagrant up
# You should see a message like:
# [default] The guest additions on this VM do not match the install version of
# VirtualBox! This may cause things such as forwarded ports, shared
# folders, and more to not work properly. If any of those things fail on
# this machine, please update the guest additions and repackage the
# box.
@jackyq2015
jackyq2015 / Monitors.java
Last active February 9, 2017 17:52 — forked from apangin/Monitors.java
Java monitor contention profiler Monitor -- ContendedEnter event
public class Monitors {
public static native void startProfiling(Object monitor);
public static native void stopProfiling();
public static native long getBlockTime();
public static native long getBlockCount();
static {
System.loadLibrary("monitors");
}