Skip to content

Instantly share code, notes, and snippets.

View grafst's full-sized avatar
🚲

grafst

🚲
  • Not a Business Inc.
  • Winterthur, Switzerland
  • X @grafst
View GitHub Profile
@grafst
grafst / get-all-repo-urls.sh
Created April 19, 2017 12:48
Get the URLs of cloned Repositories
for repo in `ls */.git -d`; do cat $repo/config | grep url| awk {'print $3'}; done
@grafst
grafst / gist:b4b4de593b08faf83c997b28f61d214d
Created August 10, 2017 21:59
laravel eloquent query template
class News extends Eloquent {
public function newQuery($excludeDeleted = true) {
return parent::newQuery($excludeDeleted)
->where(status, '=', 1);
}
}
@grafst
grafst / tel.sublime-snippet
Created March 9, 2019 12:25
Sublime tel link snippet
<snippet>
<content><![CDATA[
<a class="tel" href="tel:${1:number}" rel="nofollow" title="jetzt anrufen">${1:number}</a>
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>tel</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.html</scope>
</snippet>
@grafst
grafst / clipboard-access-in-internet-explorer.html
Last active March 13, 2019 13:43
clipboard access in internet explorer
<!-- Acces Clipboard in Internetexplorer-->
<html>
<head>
<script type="text/javascript">
function CopyToClipboard(elementId){
var input = document.getElementById(elementId);
window.clipboardData.setData ("Text", input.value);
}
function GetClipboardContent(){
return (window.clipboardData.getData("Text"));
@grafst
grafst / today-in-iso.py
Created March 22, 2019 09:02
yyyy-mm-dd
print(datetime.datetime.now().strftime("%Y-%m-%d"))
@grafst
grafst / get-ssid.bat
Created April 3, 2019 17:57
get the ssid of the currently connected wifi
powershell (get-netconnectionProfile).Name
@grafst
grafst / chocolatey.md
Last active December 4, 2020 08:12
choclatey installieren und verwenden

Chocolatey

Windows Equivalent zu aptitude und homebrew - Installiere Software à la 20xx

Installieren

  1. Powershell als Administrator ausführen
  2. Scripts für diese Session erlauben: Set-ExecutionPolicy Bypass -Scope Process -Force
  3. Installer downloaden und ausführen: iex(wget https://chocolatey.org/install.ps1)
  4. mit y bestätigen
  5. refreshenv oder powershell schliessen und neu öffnen (wieder als Administrator)
  6. Pakete installieren mit choco install ... z.B. choco install 7zip
@grafst
grafst / excel-blattschutz-entfernen.md
Created April 10, 2019 12:27
Excel Blattschutz entfernen ohne Passwort
  1. Rechtsklick --> 7-Zip --> Open archive
  2. xl/workbook.xml öffnen
  3. nach dem gewünschten Blatt suchen und die rId merken z.B. rId55
  4. Datei schliessen
  5. xl/worksheets/sheetXX.xml öffnen
  6. regex: <sheetProtection.*?/> --> entfernen (z.B. ersetzen mit empty string)
  7. Editor schliessen
  8. in 7-zip frage zum speichern mit ja bestätigen
  9. 7-zip schliessen
@grafst
grafst / split_into.py
Created April 22, 2019 14:01
split the list into at most n chunks of approximately same size
#!/usr/bin/python3
def split_into(list,n):
chunks=[[] for x in range(min(n,len(list)))]
# ^--- replace the 'min(...)' with just 'n' for empty lists if len(list)<n
for item in list:
chunks[list.index(item)%n].append(item)
return chunks
@grafst
grafst / python-http-server
Created May 11, 2019 15:18
the easiest way to get a temporary webserver running
python -m http.server