Skip to content

Instantly share code, notes, and snippets.

View alexanderadam's full-sized avatar
⌨️
⌨️

Alexander ADAM alexanderadam

⌨️
⌨️
View GitHub Profile
interface Iterator<T, TReturn = any, TNext = undefined> {
next(): {
done: boolean
value: T
}
/** Returns an iterator of the elements with the given mapping function applied. */
map<TT>(
/** A mapping function to call on every element of the iterator. */
callback: (value: T) => TT
var tryCount = 0;
var minimalUserResponseInMiliseconds = 200;
function check() {
console.clear();
before = new Date().getTime();
debugger;
after = new Date().getTime();
if (after - before > minimalUserResponseInMiliseconds) {
document.write(" Dont open Developer Tools. ");
self.location.replace(window.location.protocol + window.location.href.substring(window.location.protocol.length));
@timohuovinen
timohuovinen / virtualbox-windows.md
Last active March 31, 2024 11:48
Create and run a windows virtual machine using virtualbox

Virtualbox (free and open-source)

How to install an unlicensed copy of windows using virtualbox

  1. Install virtualbox 7 (or higher)
    1. Ubuntu 22.04 jammy for linux mint 21
    2. Download extensions pack for the same version.
  2. Virtualbox > Tools > Install Oracle VM Virtualbox Extensions Pack for the same version
  3. Download Windows 10 pro from Microsoft
  4. Create a machine
    1. System > Motherboard > Check EFI and Secure boot (boot order won’t work with EFI, required for windows 11)
  5. System > Motherboard > Check TPM 2.0 (Security chip emulation)
@MarioRuiz
MarioRuiz / smart-lola.rb
Created October 13, 2022 14:48
Learn to write Spanish and English words. Aprende a escribir palabras en Inglés y Español
# Requires an Apple Mac and Ruby
# I created this gist just to help my daughter to learn how words are written in Spanish and English.
# The script will pronounce a random word in the language selected and the child needs to write the word letter by letter.
require 'string_pattern'
require 'open3'
require 'io/console'
ENV['NOMBRE'] ||= 'Pedro'
ENGLISH = ENV['ENGLISH'] == 'true'
@dxdxdt
dxdxdt / fuckyou-gmail.en.md
Last active September 7, 2023 17:44
What to do when Gmail marks all the mails from your server as spam

What to do when Gmail marks all the mails from your server as spam

If you're self-hosting your services and having trouble getting your emails through Gmail and infuriated by Google's non-existent support, you're not the only one. I'd like to share my experiences trying to get it sorted out.

I'm the author of the post above. You can tell how arrogant Google employees are from all the previous posts he made in the past.

Model.where("column LIKE #{sanitize_sql_like(Arel.sql('%?%'), value)}")
.or(Model.where("column LIKE #{sanitize_sql_like(Arel.sql('%?%'), value)}"))
@postmodern
postmodern / github_issues_to_markdown.rb
Last active January 23, 2022 09:42
Quick and dirty ruby script to parse a copy/pasted list of GitHub Issues and output a nicely formatted markdown list that can be pasted into a blog post
#!/usr/bin/env ruby
require 'optparse'
USAGE = "usage: #{$0} [options] GITHUB_REPO_URL [FILE]"
optparser = OptionParser.new do |opts|
opts.banner = USAGE
opts.separator ''
#!/usr/bin/env python
"""
Simple script to transform openscale csv export files to a format accepted by garmin connect at
https://connect.garmin.com/modern/import-data
Note: When importing the language needs to be set to English, otherwise the import fails.
Set everything to metric units and to YYYY-MM-DD date format.
If you want to compute BMI for the file give your height (im meters) as second parameter.
@LilithWittmann
LilithWittmann / autobahn.md
Last active October 26, 2023 12:11
autobahn.md
@postmodern
postmodern / string_building_benchmarks.rb
Last active July 12, 2021 07:13
Ruby String building benchmarks
#!/usr/bin/env ruby
require 'benchmark'
require 'zlib'
Benchmark.bm(12) do |b|
n = 10_009_000
str1 = 'A'
str2 = 'A'