Skip to content

Instantly share code, notes, and snippets.

View MrDwarf7's full-sized avatar
🏠
Working from home

Blake B. MrDwarf7

🏠
Working from home
  • Australia
View GitHub Profile
@MrDwarf7
MrDwarf7 / git-pushing-multiple.rst
Created October 24, 2023 00:30 — forked from rvl/git-pushing-multiple.rst
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

@MrDwarf7
MrDwarf7 / ConvolutedTypescript.ts
Created November 30, 2023 22:32
Overly convoluted Language demonstrations
type MaybePromise<T> = T | Promise<T>;
type ConfusedFunction = <T>(arg: MaybePromise<T>) => Promise<MaybePromise<T>>;
const fetchData: ConfusedFunction = async (data) => {
const resolveData = await new Promise(resolve => setTimeout(() => resolve(data), 1000));
return typeof resolveData === 'number' ? Promise.resolve(resolveData) : resolveData;
};
(async () => {
const confusingArray = [fetchData(10), Promise.resolve(20), 30];
@MrDwarf7
MrDwarf7 / ConvolutedTypescript.ts
Created November 30, 2023 22:41
ConvolutedScriptsTwo
import _ from 'lodash';
type ConfusingObject = { [key: string]: any };
const processData = (data: ConfusingObject): ConfusingObject => {
const deepClonedData = _.cloneDeep(data);
_.forEach(deepClonedData, (value, key) => {
if (_.isArray(value)) {
deepClonedData[key] = _.chain(value).map(_.toString).sort().value();
} else if (_.isPlainObject(value)) {
@MrDwarf7
MrDwarf7 / msys2-setup.md
Created December 29, 2023 03:29 — forked from roblogic/msys2-setup.md
MSYS2 first time setup
@MrDwarf7
MrDwarf7 / tmux-cheatsheet.markdown
Created January 8, 2024 09:50 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@MrDwarf7
MrDwarf7 / jsonp.js
Created March 2, 2024 03:03 — forked from gf3/jsonp.js
Simple JSONP in vanilla JS
/**
* loadJSONP( url, hollaback [, context] ) -> Null
* - url (String): URL to data resource.
* - hollaback (Function): Function to call when data is successfully loaded,
* it receives one argument: the data.
* - context (Object): Context to invoke the hollaback function in.
*
* Load external data through a JSONP interface.
*
* ### Examples
#[derive(Serialize, Deserialize, Debug, Clone, Default)]
pub struct ConfigSqlFiles {
files: Option<Vec<Option<PathBuf>>>,
}
impl ConfigSqlFiles {
pub fn get_files(&self) -> &Vec<Option<PathBuf>> {
self.files.as_ref().unwrap()
}
}
#[test]
// #[ignore]
fn a_palindrome() {
let input = "racecar";
let output = reverse(input);
let expected = "racecar";
assert_eq!(output, expected);
}
#[test]
@MrDwarf7
MrDwarf7 / !README.md
Created July 25, 2024 07:31 — forked from mmozeiko/!README.md
Download MSVC compiler/linker & Windows SDK without installing full Visual Studio

This downloads standalone MSVC compiler, linker & other tools, also headers/libraries from Windows SDK into portable folder, without installing Visual Studio. Has bare minimum components - no UWP/Store/WindowsRT stuff, just files & tools for native desktop app development.

Run py.exe portable-msvc.py and it will download output into msvc folder. By default it will download latest available MSVC & Windows SDK - currently v14.40.33807 and v10.0.26100.0.

You can list available versions with py.exe portable-msvc.py --show-versions and then pass versions you want with --msvc-version and --sdk-version arguments.

To use cl.exe/link.exe first run setup_TARGET.bat - after that PATH/INCLUDE/LIB env variables will be updated to use all the tools as usual. You can also use clang-cl.exe with these includes & libraries.

To use clang-cl.exe without running setup.bat, pass extra /winsysroot msvc argument (msvc is folder name where output is stored).

#!/bin/bash
clog --setversion v$(toml get Cargo.toml package.version |sed 's/"//g' | rg '\d+\.\d+\.\d+') \
&& git add CHANGELOG.md && git commit -m "chore: add changelog for pre release"
#https://github.com/zitsen/xlsx2csv.rs/blob/e557aeb039fb1be3b2fa8f375441bcf95dead605/clog.sh#L1