Skip to content

Instantly share code, notes, and snippets.

View phanletrunghieu's full-sized avatar
🏎️
Running

Royce phanletrunghieu

🏎️
Running
View GitHub Profile
@osy
osy / README.md
Last active August 9, 2023 12:58
UTM on Apple M1 Guides

Thanks to the work of @agraf, @KhaosT, @imbushuo, and others, we have Virtualization.framework working on M1 Macs. These [changes][1] have been merged with QEMU v5.2.0 RC3 (will rebase once the final release is out) and integrated with UTM, a brand new QEMU frontend designed in SwiftUI for iOS 14 and macOS 11.

Screenshot

Downloads

@fragosti
fragosti / test.js
Created March 20, 2020 15:27
Posting order code
const connect = require('@0x/connect');
const subproviders = require('@0x/subproviders');
const utils = require('@0x/utils');
const wrapper = require('@0x/web3-wrapper');
const orderUtils = require('@0x/order-utils');
const contractAddresses = require('@0x/contract-addresses');
const handler = {
onUpdate: (...args) => console.log('onUpdate:', ...args),
onError: (...args) => console.log('onError:', ...args),
onClose: (...args) => console.log('onClose:', ...args),
@tehmoon
tehmoon / iptables-reload.sh
Last active October 27, 2024 17:30
IPtables and docker reload!
#!/bin/sh
set -e
## SEE https://medium.com/@ebuschini/iptables-and-docker-95e2496f0b45
## You need to add rules in DOCKER-BLOCK AND INPUT for traffic that does not go to a container.
## You only need to add one rule if the traffic goes to the container
CWD=$(cd "$(dirname "${0}")"; pwd -P)
FILE="${CWD}/$(basename "${0}")"
@erikvullings
erikvullings / deep-copy.ts
Last active September 3, 2024 09:02
Deep copy or clone in TypeScript
/**
* Deep copy function for TypeScript.
* @param T Generic type of target/copied value.
* @param target Target value to be copied.
* @see Source project, ts-deepcopy https://github.com/ykdr2017/ts-deepcopy
* @see Code pen https://codepen.io/erikvullings/pen/ejyBYg
*/
export const deepCopy = <T>(target: T): T => {
if (target === null) {
return target;
@barnybug
barnybug / docker-compose.yml
Created November 21, 2017 11:14
Docker compose for a Docker-in-docker gitlab runners setup
# Docker-in-Docker Gitlab runners setup taken from:
# https://medium.com/@tonywooster/docker-in-docker-in-gitlab-runners-220caeb708ca
dind:
restart: always
privileged: true
volumes:
- /var/lib/docker
image: docker:17.09.0-ce-dind
command:
- --storage-driver=overlay2
@dianjuar
dianjuar / Install update WordPress puglins directly.md
Last active October 10, 2024 23:37
Install update WordPress plugins without providing ftp access

Install WordPress plugins directly (without FTP)

Put this on your wp-config.php

/* That's all, stop editing! Happy blogging. */
define('FS_METHOD', 'direct');

This is unmaintained, please visit Ben-PH/spacemacs-cheatsheet

Useful Spacemacs commands

  • SPC q q - quit
  • SPC w / - split window vertically
  • SPC w - - split window horizontally
  • SPC 1 - switch to window 1
  • SPC 2 - switch to window 2
  • SPC w c - delete current window
@jlinoff
jlinoff / copy_large_file.py
Last active February 1, 2022 23:47
Python example that shows how to copy a large file showing progress.
#!/usr/bin/env python
'''
Copy a large file showing progress.
MIT License
Copyright (c) 2015 Joe Linoff
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
@protrolium
protrolium / ffmpeg.md
Last active November 12, 2024 21:27
ffmpeg guide

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

You can get the list of installed codecs with:

@n00neimp0rtant
n00neimp0rtant / gist:9515611
Last active September 5, 2024 09:24
simple squash without rebase
## within current branch, squashes all commits that are ahead of master down into one
## useful if you merged with upstream in the middle of your commits (rebase could get very ugly if this is the case)
## commit any working changes on branch "mybranchname", then...
git checkout master
git checkout -b mybranchname_temp
git merge --squash mybranchname
git commit -am "Message describing all squashed commits"
git branch -m mybranchname mybranchname_unsquashed
git branch -m mybranchname