Skip to content

Instantly share code, notes, and snippets.

View fxfactorial's full-sized avatar
🎯
Focusing

@edgararout fxfactorial

🎯
Focusing
View GitHub Profile
@naugtur
naugtur / GetOptimizationStatus.md
Created August 9, 2019 21:08 — forked from justjavac/GetOptimizationStatus.md
V8 %GetOptimizationStatus

%GetOptimizationStatus return a set of bitwise flags instead of a single value, to access the value, you need to take the binary representation of the returned value. Now, for example, if 65 is returned, the binary representation is the following:

(65).toString(2).padStart(12, '0');
// 000001000001

Each binary digit acts as a boolean with the following meaning:

@lizthegrey
lizthegrey / attributes.rb
Last active August 29, 2025 15:40
Hardening SSH with 2fa
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam'
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes'
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no'
@abelcallejo
abelcallejo / README.md
Last active August 23, 2025 22:16
Creating bootable Linux USB using Mac

Creating bootable Linux USB using Mac

mac

CentOS, Ubuntu, Slackware, etc. Whatever Linux-based OS it is, you can create a bootable USB for it by using a Mac.

1. Prepare the .iso file

Download it, copy it, whatever it takes to prepare that Linux-based OS .iso file

2. Convert the .iso file into a .img.dmg

@mustafaturan
mustafaturan / chunk.go
Created February 5, 2019 07:00
Go / Chunk Slice
# https://play.golang.org/p/JxqibtHkuO-
func chunkBy(items []string, chunkSize int) (chunks [][]string) {
for chunkSize < len(items) {
items, chunks = items[chunkSize:], append(chunks, items[0:chunkSize:chunkSize])
}
return append(chunks, items)
}
// This component is for creating and editing ctaBoxes. It openes a modal.
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import linkifyIt from 'linkify-it';
import { stopPropagation } from '../../../utils/common';
import { getFirstIcon } from '../../../utils/toolbar';
import Option from '../../../components/Option';
import { Dropdown, DropdownOption } from '../../../components/Dropdown';
@giladHaimov
giladHaimov / BasicERC20.sol
Last active March 19, 2025 19:41
Basic ERC20 implementation
pragma solidity ^0.4.19;
contract ERC20Basic {
string public constant name = "ERC20Basic";
string public constant symbol = "BSC";
uint8 public constant decimals = 18;
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
@BjornvdLaan
BjornvdLaan / ECDSA.sol
Created August 12, 2018 15:03
Verification of externally created ECDSA signatures in Solidity
pragma solidity ^0.4.24;
contract ECDSA {
function verify() public returns (bool) {
bytes32 message = ethMessageHash("TEST");
bytes memory sig = hex"bceab59162da5e511fb9c37fda207d443d05e438e5c843c57b2d5628580ce9216ffa0335834d8bb63d86fb42a8dd4d18f41bc3a301546e2c47aa1041c3a1823701";
address addr = 0x999471bb43b9c9789050386f90c1ad63dca89106;
@fxfactorial
fxfactorial / async-gen.js
Created June 25, 2018 22:45
simple async generators
async function* handle() {
let i = 0;
while (true) {
yield i++;
}
}
const sleep = () => new Promise(r => setTimeout(() => r(undefined), 1000));
async function main() {
@fxfactorial
fxfactorial / threaded-queue.cpp
Last active June 10, 2018 15:25
Producer and Consumer threads using Condition variable and mutex
// Compile With: $ clang++ -ggdb -std=c++17 -fsanitize=address src/main.cpp -o T
#include <condition_variable>
#include <iostream>
#include <mutex>
#include <queue>
#include <sstream>
#include <thread>
int main() {
@scjody
scjody / tramp-gcloud-ssh
Created February 5, 2018 18:16
EMACS TRAMP setup for "gcloud compute ssh"
;; TRAMP gcloud ssh
(add-to-list 'tramp-methods
'("gssh"
(tramp-login-program "gssh")
(tramp-login-args (("%h")))
(tramp-async-args (("-q")))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))
(tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null")
("-o" "UserKnownHostsFile=/dev/null")