Skip to content

Instantly share code, notes, and snippets.

Avatar

Alireza Davoodi alirezaDavid

View GitHub Profile
@gdamjan
gdamjan / README.md
Last active Dec 7, 2020
libvirt with ipvtap over wifi
View README.md

ipvtap over wifi for libvirt

ipvtap is similar to macvtap, but works over wifi too, since it uses the same mac address as the wifi interface.

libvirt doesn't support ipvtap, so we have to configure everything manually. Important data we need before we start:

  • the name of the wifi interface, wlan0 in my case (it's already connected - use NM or networkd+iwd).
  • the mac address of the wifi interface (it must be the same in the guest too)

On the host:

@yen3
yen3 / aarch64_virt_install.sh
Last active May 2, 2021
aarch64 virt-install commands
View aarch64_virt_install.sh
#!/bin/bash
rm -rf /home/yen3/ubuntu.qcow2
qemu-img create -f qcow2 /home/yen3/ubuntu.qcow2 10G
virsh undefine ubuntu1604arm64 --nvram
install_from_localtion() {
virt-install -n ubuntu1604arm64 --memory 1024 --arch aarch64 --vcpus 1 \
--disk /home/yen3/ubuntu.qcow2,device=disk,bus=virtio \
@m2sh
m2sh / DOSpacesStorageServiceProvider.php
Last active Apr 16, 2021
How To Use Digitalocean Spaces as Laravel Cloud filesystems
View DOSpacesStorageServiceProvider.php
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Aws\S3\S3Client;
use League\Flysystem\AwsS3v3\AwsS3Adapter;
use League\Flysystem\Filesystem;
use Storage;
View sequelizebatch.coffee
batchFindAll = (model,where,cback,size=10)->
model.count({where})
.then (res)=>
total = res
[0..Math.floor(total/size)].reduce (curr,num)=>
count = num*10
curr.then => cback(where,count,size)
,Promise.resolve()
View Demo:wsrep_gtid_domain_id
Configuration
=============
Node 1 :
[mysqld]
basedir=/home/nirbhay/project/git-repo/maria/10.1/install
datadir=/home/nirbhay/project/git-repo/maria/10.1/install/data1
log-bin
log-slave-updates
binlog_format=row
@nolanlawson
nolanlawson / protips.js
Last active Mar 31, 2021
Promise protips - stuff I wish I had known when I started with Promises
View protips.js
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@staltz
staltz / introrx.md
Last active May 8, 2021
The introduction to Reactive Programming you've been missing
View introrx.md
@antivanov
antivanov / webcrawler.js
Last active Dec 30, 2020
Simple PhantomJS-based web crawler library
View webcrawler.js
//PhantomJS http://phantomjs.org/ based web crawler Anton Ivanov anton.al.ivanov@gmail.com 2012
//UPDATE: This gist has been made into a Node.js module and now can be installed with "npm install js-crawler"
//the Node.js version does not use Phantom.JS, but the API available to the client is similar to the present gist
(function(host) {
function Crawler() {
this.visitedURLs = {};
};
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname