Skip to content

Instantly share code, notes, and snippets.

@ih2502mk
ih2502mk / list.md
Last active May 23, 2024 06:31
Quantopian Lectures Saved
@superseb
superseb / restore_rancher2_agents.md
Last active October 10, 2023 06:29
Restore Rancher 2 cluster/node agents on clusters

Restore Rancher 2 cluster/node agents on clusters

This is an unsupported scenario, see rancher/rancher#14731 when there is an official solution.

When cattle-cluster-agent and/or cattle-node-agent are accidentally deleted, or when server-url/cacerts are changed.

Generate definitions

  • Generate API token in the UI (user -> API & Keys) and save the Bearer token
  • Find the clusterid in the Rancher UI (format is c-xxxxx), its in the address bar when the cluster is selected
@tkfm-yamaguchi
tkfm-yamaguchi / lang.map.diff
Last active February 5, 2024 19:51
source-highlight's language definition file for YAML
---/usr/share/source-highlight/lang.map.old
+++/usr/share/source-highlight/lang.map
@@ -169,3 +169,5 @@
groovy = groovy.lang
json = json.lang
feature = feature.lang
+yaml = yaml.lang
+yml = yaml.lang
@dsherret
dsherret / Using.ts
Last active October 26, 2023 13:30
Typescript Disposable (using statement)
// NOTE: This is now rolled up in a package and supports more scenarios: https://github.com/dsherret/using-statement
interface IDisposable {
dispose();
}
function using<T extends IDisposable>(resource: T, func: (resource: T) => void) {
try {
func(resource);
} finally {
@leeroybrun
leeroybrun / turn_all_off.lua
Last active March 1, 2021 05:59
Fibaro LUA scenes
--[[
%% autostart
%% properties
%% globals
--]]
NB_DEVICES = 300
function turnAllOff()
fibaro:debug('Turn all devices off.')
@altrive
altrive / Install-VisualStudio.ps1
Last active March 29, 2024 14:27
Unattend install script for Visual Studio 2012 and Visual Studio 2012 Update 2
function Install-VisualStudio
{
[CmdletBinding()]
param (
[string] $ImagePath,
[string[]] $ArgumentList,
[string] $InstallPath,
[string] $ProductKey
)
Write-Verbose "Install Visual Studio 2012..."
public class DelegateCommand : DelegateCommand<object>
{
public DelegateCommand(Action executeMethod)
: base(o => executeMethod())
{
}
public DelegateCommand(Action executeMethod, Func<bool> canExecuteMethod)
: base(o => executeMethod(), o => canExecuteMethod())
{
@shbaz
shbaz / gist:1188369
Created September 2, 2011 10:48
git snippets
#
# Misc good to have commands when using git
#
# Short and nice log
git log --pretty=oneline Path
# Create a new freestanding branch
git symbolic-ref HEAD refs/heads/<branch-name>
rm .git/index -ErrorAction SilentlyContinue
@shbaz
shbaz / gist:1188041
Created September 2, 2011 06:36
All objects not in dbo or sys schema
SELECT s.name, o.name, o.type, o.type_desc, s.schema_id
FROM sys.objects AS o
INNER JOIN sys.schemas AS s ON o.schema_id = s.schema_id
WHERE s.name NOT IN ( 'dbo', 'sys' )
@shbaz
shbaz / gist:1188016
Created September 2, 2011 06:17
Find non-dbo tables, views and procedures [SQL Server]
--
-- Select the tables, views and stored procedures that are not in the [dbo] schema
--
-- Useful when double checking that prople has not run scripts with the wrong user
-- for databases that have everything in the [dbo] schema.
--
SELECT 'Table' AS [Type] ,
'[' + s.name + '].[' + t.name + ']' AS [Name]
FROM sys.tables AS t