Skip to content

Instantly share code, notes, and snippets.

@fravelgue
fravelgue / 00-Using_SQLite.dib
Created November 8, 2022 22:06
Interactive (Polyglot) Notebook using SQLite
#!markdown
# Using SQLite in Notebook
Install ExtensionLab NuGet package
#!csharp
#r "nuget: System.Data.SQLite, *-*"
#r "nuget: Microsoft.DotNet.Interactive.ExtensionLab, *-*"
@fravelgue
fravelgue / sshpass.ps1
Created January 27, 2022 19:35
sshpass: Quick and dirty non-interactive ssh password auth in Powershell
# Add your configuration
$configuration = @'
[
{ "name": "NAME", "url": "USER@HOST", "password": "PASSWORD" }
]
'@ | ConvertFrom-Json
$name = $args[0]
$url = ""
$psw = "";
@fravelgue
fravelgue / git-pull-workspace.ps1
Last active January 18, 2022 08:15
Powershell: Doing git pull in every subdirectory
$folders = Get-ChildItem -directory
foreach($folder in $folders)
{
Set-Location $folder
if (Test-Path -Path ".git") {
Write-Output "git reset & pull ${folder}"
git checkout main
git reset --hard
git pull
}
@fravelgue
fravelgue / WinStyler.cs
Last active January 11, 2022 19:15
Windows C# Remove title bar to any application
using System.Diagnostics;
using System.Runtime.InteropServices;
using static WinApi;
var process = Process.GetProcessesByName(args.FirstOrDefault()).FirstOrDefault();
if (process == null)
return;
var style = GetWindowLong(process.MainWindowHandle, GWL_STYLE);
SetWindowLong(process.MainWindowHandle, GWL_STYLE, (uint)style & ~WS_CAPTION);
@fravelgue
fravelgue / install-redmine-centos7.sh
Created April 14, 2021 06:15
Install Redmine 4.2.0 on Centos7
# https://www.rosehosting.com/blog/how-to-install-redmine-on-centos-8/
# https://tecadmin.net/install-ruby-latest-stable-centos/
yum update
yum group install "Development Tools"
yum install install epel-release
# yum config-manager --enable epel
# yum config-manager --set-enabled PowerTools
# create a user for redmine
@fravelgue
fravelgue / shopify-multiples-pixels-theme.liquid
Created December 4, 2020 11:49
Multiples Facebook pixels in Shopify. In theme.liquid, replace {{ content_for_header }} with this code
{% assign fb01 = '"ORIGINAL_FB_PIXEL"' %}
{% assign fb02 = '"ORIGINAL_FB_PIXEL","SECOND_FB_PIXEL"' %}
{% comment %}{{ content_for_header }}{% endcomment %}
{{ content_for_header | replace: fb01, fb02 }}
@fravelgue
fravelgue / facebook-pixel-executeWhenElementIsVisible.js
Last active November 10, 2020 13:28
Facebook Pixel - Is Element Visible
// https://developers.facebook.com/docs/facebook-pixel/advanced/
// This code should be loaded together with Facebook Pixel
var executeWhenElementIsVisible = function(dom_element, callback) {
if (!(dom_element instanceof HTMLElement)) {
console.error('dom_element must be a valid HTMLElement');
}
if (typeof callback !== 'function') {
@fravelgue
fravelgue / PhoneNumberExtensions.cs
Created October 26, 2020 15:48
PhoneNumber Extension Methods (libphonenumber)
//https://github.com/erezak/libphonenumber-csharp
//https://github.com/twcclegg/libphonenumber-csharp
using PhoneNumbers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace fravelgue
{
@fravelgue
fravelgue / include-javascript-jquery-in-shopify-themes.html
Last active October 9, 2020 08:55
Include javascript (jquery) in Shopify
<!DOCTYPE html>
<!--
https://shopify.dev/tutorials/include-javascript-in-shopify-themes
-->
<html>
<head>
<script>
var loadScript = function (url, callback) {
/* JavaScript that will load the jQuery library on Google's CDN.
We recommend this code: http://snipplr.com/view/18756/loadscript/.